#include "util.h"
/*
  Removes trailing newlines from strings
*/
void chomp(char* string)
{
    int len = strlen(string);
    int i;
    for (i = len-1; i >= 0; i -= 1)
    {
        if (string[i] == '\r' || string[i] == '\n')
        {
            string[i] = '\0';
        }
        else
        {
            return;
        }
    }
}

// Tells the compiler that this function never returns
void die(const char* msg, ...) __attribute__ ((noreturn));

void die(const char* msg, ...)
{
    va_list args;
    va_start(args, msg);
    vfprintf(stderr, msg, args);
    va_end(args);
    exit(1);
}



